/**
 * Copyright (C) 2024 AIDC-AI
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.alibaba.langengine.tencentmap.sdk.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class PlaceSearchResponse {

	/**
	 * Status code, 0 indicates normal, others indicate exceptions. Refer to status code
	 * description for details
	 */
	@JsonProperty("status")
	private Integer status;

	/**
	 * Status description
	 */
	@JsonProperty("message")
	private String message;

	/**
	 * Total number of search results. This service limits to return maximum 200 data
	 * items. When pagination (page_index) exceeds total pages, returns results of the
	 * last page.
	 */
	@JsonProperty("count")
	private Integer count;

	/**
	 * Unique identifier for this request, automatically generated by the system, used for
	 * tracing when results are abnormal
	 */
	@JsonProperty("request_id")
	private String requestId;

	/**
	 * Search result POI (place) array, each item is a POI (place) object
	 */
	@JsonProperty("data")
	private List<PoiData> data;

	/**
	 * Sub-location list, returned only when input parameter get_subpois=1
	 */
	@JsonProperty("sub_pois")
	private List<SubPoi> subPois;

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public String getRequestId() {
		return requestId;
	}

	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	public List<PoiData> getData() {
		return data;
	}

	public void setData(List<PoiData> data) {
		this.data = data;
	}

	public List<SubPoi> getSubPois() {
		return subPois;
	}

	public void setSubPois(List<SubPoi> subPois) {
		this.subPois = subPois;
	}

	public static class PoiData {

		/**
		 * POI (place) unique identifier
		 */
		@JsonProperty("id")
		private String id;

		/**
		 * POI (place) name
		 */
		@JsonProperty("title")
		private String title;

		/**
		 * Address
		 */
		@JsonProperty("address")
		private String address;

		/**
		 * Telephone
		 */
		@JsonProperty("tel")
		private String tel;

		/**
		 * POI (place) category
		 */
		@JsonProperty("category")
		private String category;

		/**
		 * POI (place) category code, returned when added_fields=category_code is set
		 */
		@JsonProperty("category_code")
		private Integer categoryCode;

		/**
		 * POI type, value description: 0: Ordinary POI / 1: Bus station / 2: Subway
		 * station / 3: Bus route / 4: Administrative division
		 */
		@JsonProperty("type")
		private Integer type;

		/**
		 * Coordinates
		 */
		@JsonProperty("location")
		private Location location;

		/**
		 * Straight-line distance, unit: meters. Returned when location point is passed in
		 * nearby search or city range search
		 */
		@JsonProperty("_distance")
		private Double distance;

		/**
		 * Administrative division information
		 */
		@JsonProperty("ad_info")
		private AdInfo adInfo;

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getAddress() {
			return address;
		}

		public void setAddress(String address) {
			this.address = address;
		}

		public String getTel() {
			return tel;
		}

		public void setTel(String tel) {
			this.tel = tel;
		}

		public String getCategory() {
			return category;
		}

		public void setCategory(String category) {
			this.category = category;
		}

		public Integer getCategoryCode() {
			return categoryCode;
		}

		public void setCategoryCode(Integer categoryCode) {
			this.categoryCode = categoryCode;
		}

		public Integer getType() {
			return type;
		}

		public void setType(Integer type) {
			this.type = type;
		}

		public Location getLocation() {
			return location;
		}

		public void setLocation(Location location) {
			this.location = location;
		}

		public Double getDistance() {
			return distance;
		}

		public void setDistance(Double distance) {
			this.distance = distance;
		}

		public AdInfo getAdInfo() {
			return adInfo;
		}

		public void setAdInfo(AdInfo adInfo) {
			this.adInfo = adInfo;
		}

		public static class Location {

			/**
			 * Latitude
			 */
			@JsonProperty("lat")
			private Double lat;

			/**
			 * Longitude
			 */
			@JsonProperty("lng")
			private Double lng;

			public Double getLat() {
				return lat;
			}

			public void setLat(Double lat) {
				this.lat = lat;
			}

			public Double getLng() {
				return lng;
			}

			public void setLng(Double lng) {
				this.lng = lng;
			}

		}

		public static class AdInfo {

			/**
			 * Administrative division code. Refer to administrative division code
			 * description for details
			 */
			@JsonProperty("adcode")
			private Integer adcode;

			/**
			 * Province
			 */
			@JsonProperty("province")
			private String province;

			/**
			 * City. If the current city is a provincial directly administered
			 * county-level division, this field returns empty and is returned by the
			 * district field. Note: Provincial directly administered county-level
			 * divisions have 9 and 0 as the 3rd and 4th digits of adcode respectively,
			 * e.g., Jiyuan City adcode is 419001
			 */
			@JsonProperty("city")
			private String city;

			/**
			 * District
			 */
			@JsonProperty("district")
			private String district;

			public Integer getAdcode() {
				return adcode;
			}

			public void setAdcode(Integer adcode) {
				this.adcode = adcode;
			}

			public String getProvince() {
				return province;
			}

			public void setProvince(String province) {
				this.province = province;
			}

			public String getCity() {
				return city;
			}

			public void setCity(String city) {
				this.city = city;
			}

			public String getDistrict() {
				return district;
			}

			public void setDistrict(String district) {
				this.district = district;
			}

		}

	}

	public static class SubPoi {

		/**
		 * Main location ID, corresponds to the location ID in data
		 */
		@JsonProperty("parent_id")
		private String parentId;

		/**
		 * Location unique identifier
		 */
		@JsonProperty("id")
		private String id;

		/**
		 * Location name
		 */
		@JsonProperty("title")
		private String title;

		/**
		 * Telephone
		 */
		@JsonProperty("tel")
		private String tel;

		/**
		 * POI (place) category
		 */
		@JsonProperty("category")
		private String category;

		/**
		 * POI type, value description: 0: Ordinary POI / 1: Bus station / 2: Subway
		 * station / 3: Bus route / 4: Administrative division
		 */
		@JsonProperty("type")
		private Integer type;

		/**
		 * Address
		 */
		@JsonProperty("address")
		private String address;

		/**
		 * Coordinates
		 */
		@JsonProperty("location")
		private PoiData.Location location;

		/**
		 * Administrative division information
		 */
		@JsonProperty("ad_info")
		private PoiData.AdInfo adInfo;

		public String getParentId() {
			return parentId;
		}

		public void setParentId(String parentId) {
			this.parentId = parentId;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getTel() {
			return tel;
		}

		public void setTel(String tel) {
			this.tel = tel;
		}

		public String getCategory() {
			return category;
		}

		public void setCategory(String category) {
			this.category = category;
		}

		public Integer getType() {
			return type;
		}

		public void setType(Integer type) {
			this.type = type;
		}

		public String getAddress() {
			return address;
		}

		public void setAddress(String address) {
			this.address = address;
		}

		public PoiData.Location getLocation() {
			return location;
		}

		public void setLocation(PoiData.Location location) {
			this.location = location;
		}

		public PoiData.AdInfo getAdInfo() {
			return adInfo;
		}

		public void setAdInfo(PoiData.AdInfo adInfo) {
			this.adInfo = adInfo;
		}

	}

}
